import komand
from .schema import LookupMalwareInput, LookupMalwareOutput


class LookupMalware(komand.Action):
    def __init__(self):
        super(self.__class__, self).__init__(
            name="lookup_malware",
            description="This action is used to return information about a specific malware entry by ID",
            input=LookupMalwareInput(),
            output=LookupMalwareOutput(),
        )

    def run(self, params={}):
        try:
            malware_ID = params.get("malware_ID")
            malware_report = self.connection.client.lookup_malware(malware_ID)
            return malware_report
        except Exception as e:
            self.logger.error("Error: " + str(e))
